package com.gitee.ywj1352.strategy;

import com.gitee.ywj1352.strategy.payport.PayState;
import com.gitee.ywj1352.strategy.payport.PayType;

public class Order {
    private String uid;
    private String orderId;
    private double amount;

    public Order(String uid, String orderId, double amount) {
        this.uid = uid;
        this.orderId = orderId;
        this.amount = amount;
    }


    //这个参数,完全可以用Payment 这个接口替代
    //为什么?

    //完美的解决了switch 的过程,才需要在代码
    //跟不需要写 if else

    //这个值是在支付的时候才决定的
    public PayState pay(PayType payment){
        return payment.getPayment().pay(this.uid,this.amount);
    }
}
